package model;

/**
 * A Sequence contains a series of notes.
 * An integer at each unit of time represents a note on a stave.<br>
 * <pre>
 *	1  F ------------------------------------
 *	2  E
 *	3  D ------------------------------------
 *  4  C
 *  5  B ------------------------------------
 *  6  A
 *  7  G ------------------------------------
 *  8  F
 *  9  E ------------------------------------
 *
 *  0 -> NONE SET
 * </pre>
 */

public class Sequence {
	private Instrument instrument;
	private int[] notes;
	private int volume;

	public Sequence(int length) {
		this(Instrument.PIANO, length, 100);
	}

	public Sequence(Instrument instrument, int length, int volume) {
		this(instrument, new int[length], volume);
	}

	public Sequence(Instrument instrument, int[] notes, int volume) {
		this.instrument = instrument;
		this.notes = notes;
		this.volume = volume;
	}

	public int getVolume() {
		return volume;
	}

	public void setVolume(int volume) {
		this.volume = volume;
	}

	public Instrument getInstrument() {
		return instrument;
	}

	public void setInstrument(Instrument instrument) {
		this.instrument = instrument;
	}

	public boolean hasNoteAt(int time) {
		return notes[0] > 0;
	}
	public Integer getNoteAt(int time) {
		return notes[time];
	}

	public void setNote(int time, Integer note) {
		notes[time] = note;
	}

	public int[] getAllNotes() {
		return notes;
	}

	public void removeNote(int time) {
		notes[time] = 0;
	}

	public int getLength() {
		return notes.length;
	}
}
